﻿//-----------------------------------------------------------------------
// <copyright file="ScheduleHistoryTest.cs" company="FastNET Services">
//     Copyright (c) 2008-2009. All Rights Reserved.
// </copyright>
// <license>
//     GPLv2
// </license>
// <warranty>
//     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
//     BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
//     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
//     DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//     OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// </warranty>
//-----------------------------------------------------------------------
#region Usings
using System;
using FastNET.CleanAct.Client.ManagerEngineData.Entities;
using FastNET.CleanAct.Common.Repository.Interfaces.DataInterfaces.ManagementEngine;
using Microsoft.VisualStudio.TestTools.UnitTesting;
#endregion

namespace FastNET.CleanAct.Testing.Client.ManagerEngineData.Entities
{
    /// <summary>
    /// Unit Tests for ScheduleHistoryTest
    /// </summary>
    [TestClass]
    public class ScheduleHistoryTest
    {
        /// <summary>
        /// Gets or sets the test context which provides
        /// information about and functionality for the current test run.
        /// </summary>
        public TestContext TestContext { get; set; }

        #region Result Validation

        /// <summary>
        /// Test for Result being Null
        /// </summary>
        [TestMethod]
        public void Result_Null()
        {
            new ScheduleHistory { Result = null };
        }

        /// <summary>
        /// Test for Result being successful
        /// </summary>
        [TestMethod]
        public void Result_Success()
        {
            IScheduleHistoryData data = new ScheduleHistory { Result = 100 };
            Assert.AreEqual((byte)100, data.Result, "Mismatched Data");
        }

        /// <summary>
        /// Test for Result being defaulted
        /// </summary>
        [TestMethod]
        public void Result_Default()
        {
            IScheduleHistoryData data = new ScheduleHistory();
            Assert.AreEqual(null, data.Result, "Mismatched Data");
        }

        #endregion

        #region StopTimeStamp Validation

        /// <summary>
        /// Test for StopTimeStamp being Null
        /// </summary>
        [TestMethod]
        public void StopTimeStamp_Null()
        {
            new ScheduleHistory { StopTimeStamp = null };
        }

        /// <summary>
        /// Test for StopTimeStamp being successful
        /// </summary>
        [TestMethod]
        public void StopTimeStamp_Success()
        {
            DateTime value = DateTime.UtcNow;
            IScheduleHistoryData data = new ScheduleHistory { StopTimeStamp = value };
            Assert.AreEqual(value, data.StopTimeStamp, "Mismatched Data");
        }

        /// <summary>
        /// Test for StopTimeStamp being defaulted
        /// </summary>
        [TestMethod]
        public void StopTimeStamp_Default()
        {
            IScheduleHistoryData data = new ScheduleHistory();
            Assert.AreEqual(null, data.StopTimeStamp, "Mismatched Data");
        }

        #endregion

        #region ScheduleID Validation

        /// <summary>
        /// Test for ScheduleID being successful
        /// </summary>
        [TestMethod]
        public void ScheduleID_Success()
        {
            Guid value = Guid.NewGuid();
            IScheduleHistoryData data = new ScheduleHistory { ScheduleID = value };
            Assert.AreEqual(value.ToString(), data.ScheduleID.ToString(), "Mismatched Data");
        }

        #endregion

        #region StartTimeStamp Validation

        /// <summary>
        /// Test for StartTimeStamp being successful
        /// </summary>
        [TestMethod]
        public void StartTimeStamp_Success()
        {
            DateTime value = DateTime.UtcNow;
            IScheduleHistoryData data = new ScheduleHistory { StartTimeStamp = value };
            Assert.AreEqual(value, data.StartTimeStamp, "Mismatched Data");
        }

        /// <summary>
        /// Test for StartTimeStamp being defaulted
        /// </summary>
        [TestMethod]
        public void StartTimeStamp_Default()
        {
            IScheduleHistoryData data = new ScheduleHistory();
            Assert.AreEqual(DateTime.MinValue, data.StartTimeStamp, "Mismatched Data");
        }

        #endregion
    }
}
